/**
 * 
 */

$(document).ready(function() {
    if(target=="/pages/mySalary.jsp"){
        personSalary();
    }

    if(target=="/pages/depSalary.jsp"){
        depSalary();
    }

	function personSalary(){
        $.ajax({
            url : context + "/personSalary/",
            type : "GET",
            axync : false,
            dataType : "text",
            success : function(msg) {
                //	alert("|" + msg + "|");
                if(msg == "-1") {
                    $("#salary").text("当前用户失效，请重新登录");//.prop("disable", true);
                } else {
                    $("#salary").text("您的月薪是:$"+msg);
                }
            }
        });
    }

    function depSalary(){
        $.ajax({
            url : context + "/depSalary/",
            type : "GET",
            axync : false,
            dataType : "text",
            success : function(msg) {
                //	alert("|" + msg + "|");
                if(msg == "-1") {
                    $("#salary").text("当前用户失效，请重新登录");//.prop("disable", true);
                } else {
                    var json = eval(msg);
                    var str="";
                    for(var i=0;i<json.length;i++){
                        str =str+"<tr><td>"+json[i].name+"</td><td>"+json[i].salary+"</td></tr>"
                    }
                    $("#content").html('<table><tr><th>员工</th><th>工资</th>'+str+'</table>');
                }
            }
        });
    }

});